<template>
	<view class="bruce" id="conent">
		<ul class="bubble-bgwall">
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
			<li class="bubble">Vue</li>
		</ul>
		<view class="toptitle" @click="home">
			智能农业监控系统
		</view>
		<view class="showcontent">
			<view class="introduction">
				<scroll-view id="scrollview" scroll-y>
					<view class="move">
						<view class="mask">
							<view class="form">
								<form @submit="editdevice">
									<view class="row">
										<span class="span1">用户名：</span>{{userid}}
									</view>
									<view class="row">
										<span class="span1">设备名称：</span> <input type="text" maxlength='10'
											placeholder='最多可以写10个字符' placeholder-style="color:#dcdcdc"
											name="devicename" />
									</view>

									<view class="row">
										<span class="span1">备注信息：</span>
										<textarea id="myInput" name="deviceremarks" rows="4" type="text" maxlength='140'
											placeholder='最多可以写140个字符' placeholder-style="color:#dcdcdc">
							</textarea>
									</view>

									<button class="submit" hover-class="onsubmit" size="mini"
										form-type="submit">确定</button>
								</form>
							</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
		<view class="andshowcontent">
			<my-component :title="'编辑设备'"></my-component>
			<view class="andintroduction">
				<scroll-view id="andscrollview" scroll-y>
					<view class="form">
						<form @submit="editdevice">
							<view class="row">
								<span class="span1">用户名：</span>{{userid}}
							</view>
							<view class="row">
								<span class="span1">设备名称：</span> <input type="text" maxlength='10'
									placeholder='最多可以写10个字符' placeholder-style="color:#dcdcdc" name="devicename" />
							</view>

							<view class="row">
								<span class="span1">备注信息：</span>
								<textarea id="myInput" name="deviceremarks" rows="4" type="text" maxlength='140'
									placeholder='最多可以写140个字符' placeholder-style="color:#dcdcdc">
							</textarea>
							</view>

							<button class="submit" hover-class="onsubmit" size="mini" form-type="submit">确定</button>
						</form>
					</view>

				</scroll-view>
			</view>
			<Bottom-component></Bottom-component>
		</view>
		<view class="righttop">
			<span @click="mypage">欢迎：{{userid}}</span>
		</view>
		<view class="winfroted-glass">
			<ul class="nav1">
				<li class="title1" @click="home">系统简介</li>
				<li class="title1" id="nav2">进入系统
					<ul id="nav3">
						<li class="title2" @click="Deviceinformation">设备信息</li>
						<li class="title2" @click="Realtime">设备详情</li>
						<li class="title2" @click="statisticanalysis">统计分析</li>
						<li class="title2" @click="prediction">实时数据</li>
						<li class="title2" @click="historydata">历史数据</li>
					</ul>
				</li>
				<li class="title1" @click="relatedTechnologies">相关技术</li>
				<li class="title1" @click="InsiteCommunity">进入社区</li>
				<li class="title1" @click="teamSpirit">团队风采</li>
				<li class="title1" @click="aboutUs">关于我们</li>
			</ul>
		</view>
	</view>
</template>

<script>
	import MyComponent from '../my-component/my-component.vue';
	import {
		VUE_APP_BASE_URL
	} from 'utils/request.js';
	export default {
		components: {
			MyComponent
		},
		data() {
			return {
				cssid: '',
				deviceid: '',
				userid: 'itheima0001'
			}
		},

		onLoad(e) {
			this.cssid = e.cssid;
			this.deviceid = e.deviceid;
		},
		mounted() {
			this.draw();
		},
		methods: {
			editdevice(e) {
				if (e.detail.value.devicename != '' && e.detail.value.devicename != " ") {
					let userid = uni.getStorageSync('userid')
					uni.request({
						url: VUE_APP_BASE_URL + '/device/updatedevice',
						data: {
							deviceid: this.deviceid,
							devicename: e.detail.value.devicename,
							deviceremarks: e.detail.value.deviceremarks
						},
						header: {
							"Content-Type": "application/x-www-form-urlencoded"
						},
						method: "POST",
						success: (res) => {
							if (res.data.code == 200) {
								// console.log(res);
								/*如果验证服务器成功则执行成功提示*/
								uni.showToast({
									title: "修改成功",
									icon: 'success',
									duration: 1000
								});
								// console.log(res.data.data.userid);
								setTimeout(() => {
									// 跳转到设备列表
									uni.navigateTo({
										url: '/pages/Deviceinformation/Deviceinformation?cssid=' +
											this.cssid
									});
								}, 2000);
							} else {
								uni.showToast({
									title: "参数错误",
									icon: 'error',
									duration: 2000
								});
							}
						}
					})
				} else {
					uni.showToast({
						title: "设备名不能为空",
						icon: 'error',
						duration: 1000
					});
				}
			},
			mypage() {
				uni.navigateTo({
					url: '/pages/mypage/mypage?cssid=' + this.cssid
				})
			},
			historydata() {
				uni.navigateTo({
					url: '/pages/historydata/historydata?cssid=' + this.cssid
				})
			},
			prediction() {
				uni.navigateTo({
					url: '/pages/prediction/prediction?cssid=' + this.cssid
				})
			},
			statisticanalysis() {
				uni.navigateTo({
					url: '/pages/statisticanalysis/statisticanalysis?cssid=' + this.cssid
				})
			},
			Realtime() {
				uni.navigateTo({
					url: '/pages/Realtime/Realtime?cssid=' + this.cssid
				})
			},
			Deviceinformation() {
				uni.navigateTo({
					url: '/pages/Deviceinformation/Deviceinformation?cssid=' + this.cssid
				})
			},
			LoginRegister(e) {
				uni.navigateTo({
					url: '/pages/LoginRegister/LoginRegister?cssid=' + this.cssid
				})
			},
			teamSpirit() {
				uni.reLaunch({
					url: '/pages/teamSpirit/teamSpirit?cssid=' + this.cssid
				})
			},
			InsiteCommunity() {
				uni.navigateTo({
					url: '/pages/InsiteCommunity/InsiteCommunity?cssid=' + this.cssid
				})
			},
			relatedTechnologies() {
				uni.navigateTo({
					url: '/pages/relatedTechnologies/relatedTechnologies?cssid=' + this.cssid
				})
			},
			aboutUs() {
				uni.navigateTo({
					url: '/pages/aboutUs/aboutUs?cssid=' + this.cssid
				})
			},
			forgotpassword(e) {
				uni.navigateTo({
					url: '/pages/forgotpassword/forgotpassword?cssid=' + this.cssid
				})
			},
			home() {
				uni.navigateTo({
					url: '/pages/home/home'
				})
			},
			draw(e) {
				let themes = document.querySelector('.bruce');
				let color = document.querySelectorAll(".bubble")
				let userid = uni.getStorageSync('userid')
				let username = uni.getStorageSync('username');
				this.userid = username
				if (this.cssid == 1) {
					this.button = false;
					this.title = "白天模式"
					this.cssid = 1
					themes.style.background = 'linear-gradient(270deg, #0a0b35, #120144)'
					color.forEach(function(element) {
						element.style.color = '#83c0f7'
					});

				} else {
					this.title = "夜间模式"
					this.button = true;
					this.cssid = 0
					themes.style.background = 'linear-gradient(270deg, #819cad, #81a5bd)'
					color.forEach(function(element) {
						element.style.color = '#6661e6'
					});

				}
			}

		}
	}
</script>

<style lang="scss">
	@media screen and (min-width:640px) {
		#conent {
			background: #030812 !important;

			.toptitle {
				position: fixed;
				margin-left: 5px;
				width: 100%;
				padding: 20px;
				z-index: 12;
				font-size: 24px;
				font-family: "楷体", sans-serif;
				top: 0px;
				font-weight: bold;
				color: #d8d8d8;
				left: 0;
				display: block;
				background: #393d49;
				background-image: url('https://gd-hbimg.huaban.com/23c7d4ff432744f58bbd2087eb6745a4f66d95c757996-Z6BbHB_fw1200');
				background-repeat: no-repeat;
				background-size: 100vw;
			}

			.righttop {
				position: fixed;
				margin-left: 5px;
				width: 50%;
				padding: 20px 40px 20px 0;
				z-index: 12;
				font-size: 24px;
				font-family: "楷体", sans-serif;
				top: 0;
				font-weight: bold;
				color: #d8d8d8;
				right: 0;
				display: block;
				text-align: right;
				background: transparent;

				span {
					&:hover {
						color: #009688;
					}
				}
			}

			.showcontent {
				background: rgba(255, 255, 255, 0.5);
				z-index: 10;
				display: block;
				justify-content: center;
				position: fixed;
				left: 0;
				margin: 0 50px 0 50px;
				width: 100%;
				height: 100%;
				backdrop-filter: blur(3px);

				.introduction {
					background-color: rgba(0, 0, 0, 0.126);
					display: block;
					overflow: hidden;
					box-sizing: border-box;
					position: relative;
					margin-top: 120px;
					margin-left: 120px;
					margin-right: 100px;
					padding: 20px;
					border-radius: 5px;

					#scrollview {
						width: 100%;
						height: 80vh;
						background-color: transparent;
						overflow: hidden;
						color: #f1f1f1;

						.move {

							height: 100%;
							border-radius: 5px;
							animation: mymove 10s;
							animation-iteration-count: infinite;
							animation-direction: normal;
							animation-fill-mode: backwards;
							background-repeat: no-repeat;
							background-size: 100vw;
							background-position: center center;
							background-size: cover;
							/* Safari and Chrome */
							-webkit-animation: mymove 30s;
							-webkit-animation-iteration-count: infinite;

							.mask {
								background-color: rgba(21, 21, 21, 0.6);
								border-radius: 5px;
								height: 100%;
								box-shadow: 0 0 20px 10px rgba(188, 188, 188, 0.5) inset;

								.form {
									// position: absolute;
									width: 80%;
									padding: 120px 0px 0px 0px;
									margin: auto;
									z-index: 10;


									.row {
										background-color: transparent;
										background-image: linear-gradient(to top right, #646464, #4a939e);
										padding: 20px;
										margin: 20px 0px;
										border-radius: 5px;

										.span1 {
											width: 80px;
											position: relative;
											font-weight: bold;
											left: 0px;
											font-size: 16px;
											font-weight: bold;
											float: left;
											color: rgb(51, 51, 51);
											display: inline-block;
											text-align: justify;
											text-justify: distribute-all-lines;
											text-align-last: justify;
											z-index: 10;
										}

										input {
											width: 100%;
											padding-top: 10px;
											color: #f0f0f0;
										}

										textarea {
											padding-top: 30px;
											width: 100%;
											color: #f0f0f0;
										}

										&:hover {
											// background-color: rgba(194, 252, 252, .13);
											box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.157), 0 1.7px 2.6px rgba(0, 0, 0, 0.224), 0 3.5px 5.3px rgba(0, 0, 0, 0.28), 0 7.3px 11px rgba(0, 0, 0, 0.346), 0 20px 30px rgba(0, 0, 0, 0.5);
										}
									}

									.submit {
										display: block;
										position: relative;
										justify-content: center;
										justify-content: space-between;
										top: 30px;
										margin: auto;
										padding: 5px;
										width: 200px;
										border-radius: 50rpx;
										box-shadow: rgb(165, 230, 230) 0rpx 10rpx 20rpx;

									}

									.onsubmit {
										transform: scale(0.9);
									}
								}
							}
						}


						@keyframes mymove {
							0% {
								background-image: url('http://www.iotxfd.cn/img/bg-slider/bg-1.jpg');
							}

							33% {
								background-image: url('https://gd-hbimg.huaban.com/b3b3caf5e3403da7db7b734396367d20585c857919e4a-K6Z0NC_fw1200');
							}

							66% {
								background-image: url('https://gd-hbimg.huaban.com/d6f122783f38a8b18021b7db1198bf80816d5c0222d16-Rh4qAN_fw1200');
							}

							100% {
								background-image: url('http://www.iotxfd.cn/img/bg-slider/bg-1.jpg');
							}
						}

						@-webkit-keyframes mymove

						/* Safari and Chrome */
							{
							0% {
								background-image: url('http://www.iotxfd.cn/img/bg-slider/bg-1.jpg');
							}

							33% {
								background-image: url('https://gd-hbimg.huaban.com/b3b3caf5e3403da7db7b734396367d20585c857919e4a-K6Z0NC_fw1200');
							}

							66% {
								background-image: url('https://gd-hbimg.huaban.com/d6f122783f38a8b18021b7db1198bf80816d5c0222d16-Rh4qAN_fw1200');
							}

							100% {
								background-image: url('http://www.iotxfd.cn/img/bg-slider/bg-1.jpg');
							}
						}

					}


				}

			}

			.andshowcontent {
				display: none;
			}

			.winfroted-glass {
				background-color: transparent;
				z-index: 10;
				width: 140px;
				display: flex;
				position: fixed;
				left: 0px;
				top: 10px;

				.nav1 {
					margin-top: 30px;
					width: 120px;
					height: 100vh;
					background-color: #393d49;
					position: relative;
					display: block;
					margin-left: 5px;
					box-sizing: border-box;
					padding: 50px 0 0 0;
					border-left: 5px solid #222e6f;
					justify-content: center;
					text-align: center;

					.title1 {
						width: 100%;
						margin: 10px auto;
						padding: 10px 0;
						list-style: none;
						text-align: center;
						color: #d8d8d8;
						transition: background-color 0.3s ease;

						&:hover {
							background: #009688;
							border-right: #ffffff 2px solid;
							cursor: pointer;
						}
					}

					.title1:nth-child(2) {
						#nav3 {
							display: none;
							overflow: hidden;
							box-sizing: border-box;
						}

						&:hover {
							#nav3 {
								display: block;
								position: relative;
								margin-top: 10px;
								left: 0px;
								width: 100%;

								.title2 {
									width: 100%;
									left: -14px;
									margin: 10px auto;
									position: relative;
									padding: 10px 0;
									list-style: none;
									display: block;
									text-align: center;
									transition: background-color 0.3s ease;

									&:hover {
										display: block;
										width: 100%;
										margin: 10px auto;
										padding: 10px 0;
										list-style: none;
										display: block;
										text-align: center;
										background: linear-gradient(to left, #9cd3d3, #008174) no-repeat right bottom;
										background-size: 90% 2px;
										transition: background-size 0.3s;
									}
								}

								&:hover {
									background: #008174;
								}
							}
						}
					}


				}

			}
		}
	}

	.bruce {
		background-image: linear-gradient(270deg, #819cad, #81a5bd);
		height: 100vh;
		display: flex;
		justify-content: center;
		align-items: center;
		overflow: hidden;

		.showcontent {
			display: none;
		}

		.andshowcontent {
			z-index: 10;
			display: block;
			justify-content: center;
			position: fixed;
			margin: 0 50px 0 50px;
			width: 100%;
			height: 100%;

			.andintroduction {
				background-color: rgba(0, 0, 0, 0.426);
				backdrop-filter: blur(2px);
				display: block;
				overflow: hidden;
				box-sizing: border-box;
				position: relative;
				margin-top: 10vh;
				margin-left: 0px;
				margin-right: 0px;
				bottom: 63px;
				padding: 10px;

				#andscrollview {
					width: 100%;
					padding-top: 60px;
					height: 90vh;
					padding-bottom: 5px;
					box-sizing: border-box;
					color: #f1f1f1;
					font-size: 18px;
					background-color: transparent;

					.form {

						width: 100%;
						padding: 10px 0px;
						z-index: 10;

						.row {
							background-color: transparent;
							background-image: linear-gradient(to top right, #646464, #4a939e);
							padding: 10px;
							margin: 10px 0px;
							border-radius: 5px;

							.span1 {
								width: 100px;
								position: relative;
								font-weight: bold;
								left: 0px;
								font-size: 16px;
								font-weight: bold;
								float: left;
								color: rgb(51, 51, 51);
								display: inline-block;
								text-align: justify;
								text-justify: distribute-all-lines;
								text-align-last: justify;
								z-index: 10;
							}

							input {
								width: 240px;
							}

							textarea {

								width: 100%;
								// background-color: #aaaaaa;
							}
						}

						.submit {
							display: block;
							position: relative;
							justify-content: center;
							justify-content: space-between;
							top: 30px;
							margin: auto;
							padding: 5px;
							width: 200px;
							border-radius: 50rpx;
							box-shadow: rgb(165, 230, 230) 0rpx 10rpx 20rpx;

						}

						.onsubmit {
							transform: scale(0.9);
						}
					}

				}
			}
		}

		.winfroted-glass {
			display: none;
		}

		.toptitle {
			display: none;
		}

		.righttop {
			display: none;
		}

		@media (max-width: 640px) {
			.frosted-glass .title {
				font-size: 2em;
			}
		}
	}

	.bubble-bgwall {
		position: relative;
		width: 100%;
		height: 100%;
		list-style: none;
		padding: 0;
		margin: 0;
		display: flex;
		flex-direction: column;
		align-items: flex-end;
	}

	.bubble {
		display: flex;
		position: absolute;
		bottom: -200px;
		justify-content: center;
		align-items: center;
		border-radius: 10px;
		width: 50px;
		height: 50px;
		background-color: rgba(255, 255, 255, 0.15);
		color: #44397a;
		animation: bubble 15s infinite;
	}

	.bubble:nth-child(1) {
		left: 10%;
	}

	.bubble:nth-child(2) {
		left: 20%;
		width: 90px;
		height: 90px;
		animation-duration: 7s;
		animation-delay: 2s;
	}

	.bubble:nth-child(3) {
		left: 25%;
		animation-delay: 4s;
	}

	.bubble:nth-child(4) {
		left: 40%;
		width: 60px;
		height: 60px;
		background-color: rgba(255, 255, 255, 0.3);
		animation-duration: 8s;
	}

	.bubble:nth-child(5) {
		left: 70%;
	}

	.bubble:nth-child(6) {
		left: 80%;
		width: 120px;
		height: 120px;
		background-color: rgba(255, 255, 255, 0.2);
		animation-delay: 3s;
	}

	.bubble:nth-child(7) {
		left: 32%;
		width: 160px;
		height: 160px;
		animation-delay: 2s;
	}

	.bubble:nth-child(8) {
		left: 55%;
		width: 40px;
		height: 40px;
		font-size: 12px;
		animation-duration: 15s;
		animation-delay: 4s;
	}

	.bubble:nth-child(9) {
		left: 25%;
		width: 40px;
		height: 40px;
		background-color: rgba(255, 255, 255, 0.3);
		font-size: 12px;
		animation-duration: 12s;
		animation-delay: 2s;
	}

	.bubble:nth-child(10) {
		left: 85%;
		width: 160px;
		height: 160px;
		animation-delay: 5s;
	}

	@keyframes bubble {
		0% {
			opacity: 0.5;
			transform: translateY(0) rotate(45deg);
		}

		25% {
			opacity: 0.75;
			transform: translateY(-400px) rotate(90deg);
		}

		50% {
			opacity: 1;
			transform: translateY(-600px) rotate(135deg);
		}

		100% {
			opacity: 0;
			transform: translateY(-1000px) rotate(180deg);
		}
	}

	@keyframes code {
		0% {
			opacity: 0;
		}

		100% {
			opacity: 1;
		}
	}
</style>